package mysql

import "gorm.io/gorm"

type Orders struct {
	gorm.Model
	UserId        int     `gorm:"type:int(10);not null;comment:用户id"`
	GoodsId       int     `gorm:"type:int(10);not null;comment:'商品id'"`
	GoodsTitle    string  `gorm:"type:varchar(20);not null;comment:商品标题"`
	OrdersSn      string  `gorm:"type:varchar(100);unique;not null;comment:订单编号"`
	OrderSun      int     `gorm:"type:int(10);not null;comment:订单数量"`
	OrdersState   int     `gorm:"type:int(10);not null;comment:订单状态"`
	OrdersAmount  float64 `gorm:"type:decimal(10,2);not null;comment:订单金额"`
	OrdersPayment int     `gorm:"type:int(10);not null;comment:支付类型"`
}

func (o *Orders) Create() error {
	return DB.Debug().Create(&o).Error
}
